<template>
	<view>
		<login :backpage="backpage" :backtype="backtype" @loginBack="loginOk"></login>
		<button  class="backButton" @click="backHome">返回首页</button>
	</view>
</template>

<script>
	export default {
		mounted() {
			console.log('mounted-----');
			this.user = uni.getStorageSync('userKey');
		},
		onShow() {
			console.log('onShow-----');
			this.user = uni.getStorageSync('userKey');
		},
		onLoad(options) {
			console.log('onLoad----',options);
			this.backpage=options.backpage;
			this.backtype=options.backtype;
			this.classify1=options.classify1;
		},
		// onBackPress(event) {
		// 	if('1'==this.backtype){
		// 		uni.redirectTo({
		// 			url:this.backpage
		// 		})
		// 	}else if('2'==this.backtype){
		// 		uni.switchTab({
		// 			url:this.backpage
		// 		})
		// 	}
		// 	return true;
		// },
		data() {
			return {
				user:undefined,
				classify1:'',
				backpage:'',
				backtype:''
			};
		},
		methods:{
			loginOk(){
				this.user = uni.getStorageSync('userKey');
				if('1'==this.backtype){
					uni.redirectTo({
						url:this.backpage+'?classify1='+this.classify1
					})
				}else if('2'==this.backtype){
					uni.switchTab({
						url:this.backpage
					})
				}
			},
			backHome(){
				uni.switchTab({
					url:'../home/home'
				})
			},
			lagoutBack(){
				console.log('hahahahah')
				this.user = uni.getStorageSync('userKey');
			},
			
		}
	}
</script>

<style lang="scss">
 .backButton{
	 padding-left: 30rpx;
	 padding-right: 30rpx;
	 margin-left: 30rpx;
	 margin-right: 30rpx;
	 // line-height: 120rpx;
	 // height: 120rpx;
	 // padding: 10px;
	 // padding-top: 10px;
 }
</style>
